package com.igoal.campaign.xmas2010.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.ui.ModelMap;

import com.igoal.campaign.xmas2010.service.CardService;
import com.igoal.campaign.xmas2010.web.XMASModel;
import com.igoal.dto.UserDTO;
import com.igoal.service.MailService;
import com.igoal.service.UserManagerExt;
import com.igoal.web.BaseControllerDelegate;

public abstract class BaseController {
	@Autowired
	CardService cardService;
	
	@Autowired
	MailService mailService;
	
	@Autowired
	UserManagerExt userManagerExt;
	
	@Autowired
	@Qualifier("controllerDelegate")
	BaseControllerDelegate delegate;
	
	protected final String DEFAULT_CREATE_CARD_VIEW = "createCard";
	protected final String DEFAULT_CREATE_CARD_SUCCESSFUL_VIEW = "createCardSuccessful";
	protected final String DEFAULT_CARD_PUBLIC_VIEW = "cardPublic";
	
	public boolean isLoginUser() {
		return delegate.isLoginUser();
	}
	
	public String getUserInSession(){
		return delegate.getUserInSession();
	}
	
	public UserDTO getUserInSessionInfo() {
		return delegate.getUserSession(userManagerExt);
	}

	public void applyModel(ModelMap modelMap, XMASModel model){
		delegate.applyModel(modelMap, model);
	}
	
	public String getViewPrefix() {
		return "xmas2010/";
	}
	
}
